﻿using System;
using FluentAssertions;
using NUnit.Framework;
using ReactiveGraph.Core;
using ReactiveGraph.Tests.Containers;

namespace ReactiveGraph.Tests
{
    [TestFixture]
    public class ReactiveNodeListTests
    {
        [Test]
        public void KeepsNameMap()
        {
            var defaultNodeFactory = new DefaultTestContainer();
            var collection = new ReactiveNodeList();
            var node = defaultNodeFactory.GetNode<IReactiveNode>();
            collection.Add(node);
            collection[node.NodeName].Should().Be(node);
            collection.Remove(node);
            collection.Invoking(list => { var x = list[node.NodeName]; }).ShouldThrow<Exception>();
        }
    }
}
